package com.platform.server.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.platform.server.dao.UserDao;
import com.platform.server.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	
	/**
	 * 用户列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> selectUserList(String userid,String startTime,String endTime,String username,String mobile,String grade,String age,String tuimobile,String isEnprise,String isUser) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("startTime", startTime);
		map.put("endTime", endTime);
		map.put("username", username);
		map.put("mobile", mobile);
		map.put("gender", grade);
		map.put("age", age);
		map.put("tuimobile", tuimobile);
		map.put("isEnprise", isEnprise);
		map.put("isUser", isUser);
		return userDao.selectUserList(map);
	}

	/**
	 * 对用户进行封号或解封
	 */
	@Override
	public int updateUserStatu(Integer userid, String is_ban) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("is_ban", is_ban);
		return userDao.updateUserStatu(map);
	}

	/**
	 * 查看用户的推荐人列表
	 */
	@Override
	public String[] selectRecommendList(String mobile) {
		return userDao.selectRecommendList(mobile);
	}

	/**
	 * 查看积分
	 */
	@Override
	public List<Map<String,Object>> selectIntegral() {
		return userDao.selectIntegral();
	}

	/**
	 * 修改积分设置
	 */
	@Override
	public int integralSet(String common_vip, String copper_vip, String silver_vip, String gold_vip, String five_star,String tow_star,
			String server, String Integral_arrival, String recommend_integral, String vip_server_discount) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("common_vip", common_vip);
		map.put("copper_vip", copper_vip);
		map.put("silver_vip", silver_vip);
		map.put("gold_vip", gold_vip);
		map.put("five_star", five_star);
		map.put("tow_star", tow_star);
		map.put("server", server);
		map.put("Integral_arrival", Integral_arrival);
		map.put("recommend_integral", recommend_integral);
		map.put("vip_server_discount", vip_server_discount);
		return userDao.integralSet(map);
	}
	/**
	 * 企业用户列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> selectEnterpriseUserList(String userid,
			String startTime, String endTime, String username, String mobile,
			String addres, String isUser) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("startTime", startTime);
		map.put("endTime", endTime);
		map.put("username", username);
		map.put("mobile", mobile);
		map.put("addres", addres);
		map.put("isUser", isUser);
		
		return userDao.selectEnterpriseUserList(map);
	}
	/**
	 * 企业员工列表 -
	 * @return
	 */
	@Override
	public List<Map<String, Object>> selectEntUserList(String userid,
			String username, String mobile, String addres, String gender) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("username", username);
		map.put("mobile", mobile);
		map.put("addres", addres);
		map.put("gender", gender);
		return userDao.selectEntUserList(map);
	}
	/**
	 * 企业服务列表  -
	 * @return
	 */
	@Override
	public List<Map<String, Object>> selectEntUserOrderList(String userid,
			String startTime, String endTime, String server_type,
			String staff_id, String addres, String gender) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("startTime", startTime);
		map.put("end_time", endTime);
		map.put("server_type", server_type);
		map.put("staff_id", staff_id);
		map.put("addres", addres);
		map.put("gender", gender);
		return userDao.selectEntUserOrderList(map);
	}
	/**
	 * 下级用户列表
	 */
	@Override
	public List<Map<String, Object>> selectOneUserList(String userid,
			String startTime, String endTime, String username,
			String address, String mobile, String level) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userid", userid);
		map.put("level", level);
		map.put("startTime", startTime);
		map.put("end_time", endTime);
		map.put("username", username);
		map.put("address", address);
		map.put("mobile", mobile);
		return userDao.selectOneUserList(map);
	}
	/**
	 * 用户服务列表
	 */
	@Override
	public List<Map<String, Object>> selectUserOrderList(String startTime,
			String endTime, String order_id, String server_type, String mobile, String user_id) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("order_id", order_id);
		map.put("startTime", startTime);
		map.put("end_time", endTime);
		map.put("server_type", server_type);
		map.put("mobile", mobile);
		map.put("user_id", user_id);
		return userDao.selectUserOrderList(map);
	}

}
